<?php
/**
 * @version 	$Id$
 * @author 		Luu Trong Hieu <tronghieu1012@yahoo.com>
 * @license 	GNU/GPL see license.php
 * @copyright 	Copyright (c) 2010 by Luu Trong Hieu. All right reseverd.
 */
defined('IN_FLYWHEEL') or die();
/**
 * Flywheel Abstract Form Element
 * 
 * @abstract 
 * @package 	system
 * @subpackage 	form
 *
 */
abstract class fFormElement {
	protected $_options = array();
	/**
	 * name of element
	 *
	 * @var string
	 */
	protected $_name;
	
	/**
	 * Constructor of fFormElement
	 *
	 * @param string $name
	 */
	public function __construct($name, $options = array()) {
		$this->_name = $name;
		$this->_options = array_merge($this->_options, $options);
	}
	
	/**
	 * set a option value with a default value.
	 *
	 * @param string $name   The option name
	 * @param mixed  $value  The default value	 
	 */
	public function setOption($name, $value = null)	{
	  $this->_options[$name] = $value;
	}
	
	public function unsetOption($name) {
		unset($this->_options[$name]);
	}
	
	public function getOption($name) {
		return $this->_options[$name];
	}
	
	public function getOptions() {
		return $this->_options;
	}
	
	abstract public function render();
}